//
//  CHSelectTableViewController.swift
//  CHSimpleUI
//
//  Created by cyptt on 2022/8/1.
//

import UIKit

class TableViewSelectAllController: UIViewController {

    var signViewManage:SignViewManage?
    override func viewDidLoad() {
        
        self.signViewManage = SignViewManage.init(vc: self)
        super.viewDidLoad()

        self.view.backgroundColor = UIColor.white
        
        self.view.addSubview(selectAllView)
        self.view.addSubview(self.showAll)
        self.view.addSubview(self.hideAll)
        
        self.view.addSubview(self.selectAllBtn)
        self.selectAllView.snp.makeConstraints { make in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.top.equalTo(150)
            make.bottom.equalTo(-80)
        }
        
        self.selectAllBtn.snp.makeConstraints { make in
            make.left.equalTo(60)
            make.width.height.equalTo(30)
            make.bottom.equalTo(-50)
        }
        
        self.showAll.snp.makeConstraints { make in
            make.left.equalTo(160)
            make.width.height.equalTo(60)
            make.bottom.equalTo(-20)
        }
        self.hideAll.snp.makeConstraints { make in
            make.left.equalTo(260)
            make.width.height.equalTo(60)
            make.bottom.equalTo(-20)
        }
        
        self.selectAllBtn.btnClickCallBack { btn in
            btn.isSelected = !btn.isSelected
            if btn.isSelected {
                self.signViewManage?.selectAllClick(isSelect: true)
            }else{
                self.signViewManage?.selectAllClick(isSelect: false)
            }
        }
        
        self.showAll.btnClickCallBack { btn in
            self.signViewManage?.showAllSignClick()
        }
        
        self.hideAll.btnClickCallBack { btn in
            self.signViewManage?.cancelAllSignClick()
        }
    }
    
    
    
    //MARK:- lazy
    
    lazy var selectAllView = {()-> SignTabView in
        let v:SignTabView = SignTabView.init(viewM: self.signViewManage, type: .SIGN)

        v.backgroundColor = UIColor.gray
        return v
    }()
    
    
    
    lazy var selectAllBtn = {()-> CHClickEdgeInsetsButton in
        let v:CHClickEdgeInsetsButton = CHClickEdgeInsetsButton.init(type: .custom)
        let img:UIImage? =  UIImage.init(named: "check_box_normal", in: CHBundle.bundle(), compatibleWith: nil)
        let imged:UIImage? =  UIImage.init(named: "check_box_selected", in: CHBundle.bundle(), compatibleWith: nil)
        v.setImage(img , for: .normal)
        v.setImage(imged , for: .selected)
       
        return v
    }()
    
    lazy var showAll = {()-> CHClickEdgeInsetsButton in
        let v:CHClickEdgeInsetsButton = CHClickEdgeInsetsButton.init(type: .custom)
        v.setTitle("显示", for: .normal)
        v.backgroundColor = UIColor.gray
        return v
    }()
    
    lazy var hideAll = {()-> CHClickEdgeInsetsButton in
        let v:CHClickEdgeInsetsButton = CHClickEdgeInsetsButton.init(type: .custom)
        v.setTitle("隐藏", for: .normal)
        v.backgroundColor = UIColor.red
        return v
    }()


    

}
